package im.agents.migration;

import im.domain.Context;
import im.domain.XMLSerializer;
import jade.core.AID;
import jade.core.Agent;
import jade.domain.FIPANames;
import jade.lang.acl.ACLMessage;
import jade.proto.AchieveREInitiator;

/**
 * CLASSE NON UTILIZZATA, SI PUO ELIMINARE
 *
 */
public class ContextDataRequester extends AchieveREInitiator{
	
	//private ACLMessage request;
	Context context;
	//Context actual_context;
	//boolean done = false;
	
	public ContextDataRequester(Agent myAgent,ACLMessage request) {
		
		super(myAgent,request /*new ACLMessage(ACLMessage.REQUEST)*/);
		System.out.println("richiesta dati al context manager");
	/*	ACLMessage request = new ACLMessage(ACLMessage.REQUEST);
		request.setProtocol(FIPANames.InteractionProtocol.FIPA_REQUEST);
		request.setSender(myAgent.getAID());
		request.addReceiver(cmAID);
		*/
		// TODO Auto-generated constructor stub
	}

	@Override
	protected void handleInform(ACLMessage inform) {
		context = (Context) XMLSerializer.doDeserialize(inform.getContent());
		System.out.println("BELLA, ho ricevuto"+inform.toString());
	}
	
	public Context getContext(){
		return context;
	}

}
